<div class="content-wrapper">

    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>

        <h1 class="pull-right" id="dberp-menu-top">
            <?php echo $this->HelpUrl('goodsSerialNumber'); ?>
        </h1>

    </section>

    <section class="content">
        <?php echo $this->partial('layout/messages'); ?>

        <div class="row">
            <div class="col-xs-12">
                <div class="box erp-box">

                    <div class="box-body table-responsive no-padding">
                        <table class="table table-hover">
                            <thead>
                            <tr class="erp-bg-thead">
                                <th style="width: 18%"><?php echo $this->translate('商品序列号'); ?>-<?php echo $this->translate('数量：').$this->goodsSerialList->getTotalItemCount(); ?></th>
                                <th style="width: 24%"><?php echo $this->translate('商品名称'); ?></th>
                                <th style="width: 16%"><?php echo $this->translate('仓库'); ?></th>
                                <th style="width: 10%"><?php echo $this->translate('状态'); ?></th>
                                <th style="width: 12%"><?php echo $this->translate('出库时间'); ?></th>
                                <th style="width: 12%"><?php echo $this->translate('添加时间'); ?></th>
                                <th style="width: 8%"></th>
                            </tr>
                            <?php
                            $sForm = $this->searchForm;
                            $sForm->prepare();
                            ?>
                            <?php echo $this->form()->openTag($sForm); ?>
                            <tr>
                                <td>
                                    <?php echo $this->formElement($sForm->get('serial_number')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('serial_number'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('goods_name')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('goods_name'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('warehouse_name')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('warehouse_name'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <?php echo $this->formElement($sForm->get('serial_number_state')); ?>
                                    <?php echo $this->formElementErrors($sForm->get('serial_number_state'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?php echo $this->formElement($sForm->get('o_start_time')); ?>
                                    </p>
                                    <div>
                                        <?php echo $this->formElement($sForm->get('o_end_time')); ?>
                                    </div>
                                    <?php echo $this->formElementErrors($sForm->get('o_start_time'), ['class'=>'error-message']);?>
                                    <?php echo $this->formElementErrors($sForm->get('o_end_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <p>
                                        <?php echo $this->formElement($sForm->get('i_start_time')); ?>
                                    </p>
                                    <div>
                                        <?php echo $this->formElement($sForm->get('i_end_time')); ?>
                                    </div>
                                    <?php echo $this->formElementErrors($sForm->get('i_start_time'), ['class'=>'error-message']);?>
                                    <?php echo $this->formElementErrors($sForm->get('i_end_time'), ['class'=>'error-message']);?>
                                </td>
                                <td>
                                    <button type="submit" class="btn btn-info btn-sm"><i class="fa fa-search"></i></button>
                                    <?php
                                    $formData = $sForm->getData();
                                    if(!empty(array_filter($formData))
                                        || $formData['serial_number_state'] != '') { ?>
                                        <a href="<?php echo $this->url('goods-serial-number');?>" class="btn btn-default btn-sm"><i class="fa fa-reply"></i></a>
                                    <?php } ?>
                                </td>
                            </tr>
                            <?php echo $this->form()->closeTag(); ?>
                            </thead>

                            <?php if(isset($this->goodsSerialList) && $this->goodsSerialList->getTotalItemCount() > 0) { foreach ($this->goodsSerialList as $serialValue) { ?>
                                <tr>
                                    <td><?php echo $this->escapeHtml($serialValue[0]->getSerialNumber()); ?></td>
                                    <td><?php echo $this->escapeHtml($serialValue['goodsName']); ?></td>
                                    <td><?php echo $this->escapeHtml($serialValue['warehouseName']); ?></td>
                                    <td><?php echo $this->storeHelper()->serialNumberState($serialValue[0]->getSerialNumberState()); ?></td>
                                    <td><?php echo !empty($serialValue[0]->getOutboundTime()) ? date("Y-m-d H:i:s", $serialValue[0]->getOutboundTime()) : ''; ?></td>
                                    <td><?php echo date("Y-m-d H:i:s", $serialValue[0]->getAddTime()); ?></td>
                                </tr>
                            <?php } } else { ?>
                                <tfoot>
                                <tr>
                                    <td colspan="6"><?php echo $this->translate('暂无商品序列号信息'); ?></td>
                                </tr>
                                </tfoot>
                            <?php } ?>
                        </table>
                    </div>
                    <div class="box-footer clearfix">
                        <?php echo $this->paginationControl($this->goodsSerialList, 'Sliding', 'layout/page', ['route' => 'goods-serial-number']); ?>
                    </div>
                </div>

            </div>
        </div>

    </section>
</div>
<script type="text/javascript">
    laydate.render({elem: '#o_start_time'});
    laydate.render({elem: '#o_end_time'});
    laydate.render({elem: '#i_start_time'});
    laydate.render({elem: '#i_end_time'});
</script>